package com.gettec.lims.client.window;


 
import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowData;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuBar;
import com.extjs.gxt.ui.client.widget.menu.MenuBarItem;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.gettec.lims.client.grid.RegSheetGridView;
import com.gettec.lims.client.menu.MenuItemEx;
import com.gettec.lims.client.menu.MenuListener;
import com.gettec.lims.shared.model.RegSheet;
import com.google.gwt.user.client.Element;
  
public class RegSheetWindow extends Window {  
  
   
    private final  RegSheetGridView rgv=new RegSheetGridView();
    public RegSheetWindow(final RegSheet sheed) {  
     
        setWidth(700);  
        setHeight(600);  
        setResizable(true);  
        setLayout(new FitLayout());  
  
     /*   final Button btnSave = new Button("保存");  
        btnSave.setIconStyle("save");  
        btnSave.addSelectionListener(new SelectionListener<ButtonEvent>() {  
            public void componentSelected(ButtonEvent ce) {  
                btnSave.setEnabled(false);  
                if (regForm.isValid()) {  
                    hide(btnSave);  
                    regForm.save(sheed);  
                } else {  
                    btnSave.setEnabled(true);  
                }  
            }  
        });  
        addButton(btnSave);  */
    }  
    @Override  
    protected void onRender(Element parent, int pos) {  
    	  setWidth(900);  //在这设置才有用
    	  setHeight(300);  
        super.onRender(parent, pos);  
      /*  List<MenuItemEx> list=new ArrayList<MenuItemEx>();
        
        Menu menu = new Menu();   
        
        MenuItemEx item1 = new MenuItemEx("委托登记单","新增工作单");   
        menu.add(item1);   
        list.add(item1);
        MenuItemEx item2 = new MenuItemEx("委托登记单","修改记录数据");   
        menu.add(item2); 
        list.add(item2);
        MenuItemEx item3 = new MenuItemEx("委托登记单","删除记录数据");   
        menu.add(item3); 
        list.add(item3);
        MenuBar bar = new MenuBar();   
        bar.setBorders(true);   
        bar.setStyleAttribute("borderTop", "none");   
        bar.add(new MenuBarItem("文件", menu));   
      
        Menu sub2 = new Menu(); 
        MenuItemEx item4=new MenuItemEx("委托登记单","检测配置任务");
        sub2.add(item4);   
        list.add(item4);
      
        MenuBarItem edit = new MenuBarItem("检测", sub2);   
        bar.add(edit);   

        ContentPanel panel = new ContentPanel();  
      //  panel.add(rgv);
        panel.setHeading("样品信息管理");   
        panel.setTopComponent(bar);   
        
     // menuListener(list);
       add(panel, new FlowData(10));   */

        add(rgv);  
     
        //add(siForm);
    }  
    private void menuListener(List<MenuItemEx> list)
    {
    	for (MenuItemEx it:list) 
    	{
    		
    		it.addSelectionListener(new MenuListener());

		}
    }
  
}  
